//
// Created by 谢哲 on 2021/5/20.
//

#include <iostream>
using namespace std;

constexpr long long mod = 1e5 + 3;

long long fast_pow(long long a, long long b) {
    if (a == 0ll) return 0;
    long long ans = 1, base = a;
    while (b) {
        if (b & 1ll) {
            ans = (ans * base) % mod;
        }
        base = (base * base) % mod;
        b >>= 1;
    }
    return ans;
}

int main() {
    long long m, n;
    cin >> m >> n;

    long long ans = ((fast_pow(m, n) - m * fast_pow(m-1, n-1)) % mod + mod) % mod;
    cout << ans;

    return 0;
}